home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / yatzys_1 / input.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-07-27  |  3.2 KB  |  113 lines

  1. VERSION 5.00
  2. Begin VB.Form frmInput 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "Yatzy"
  5.    ClientHeight    =   1575
  6.    ClientLeft      =   45
  7.    ClientTop       =   330
  8.    ClientWidth     =   2190
  9.    ClipControls    =   0   'False
  10.    ControlBox      =   0   'False
  11.    Icon            =   "Input.frx":0000
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   1575
  16.    ScaleWidth      =   2190
  17.    ShowInTaskbar   =   0   'False
  18.    StartUpPosition =   1  'CenterOwner
  19.    Begin VB.ComboBox cmbInput 
  20.       Height          =   315
  21.       ItemData        =   "Input.frx":000C
  22.       Left            =   120
  23.       List            =   "Input.frx":000E
  24.       Style           =   2  'Dropdown List
  25.       TabIndex        =   4
  26.       Top             =   600
  27.       Width           =   975
  28.    End
  29.    Begin VB.CommandButton cmdCancel 
  30.       Caption         =   "Avbryt"
  31.       Height          =   375
  32.       Left            =   120
  33.       TabIndex        =   3
  34.       Top             =   1080
  35.       Width           =   855
  36.    End
  37.    Begin VB.CommandButton cmdOk 
  38.       Caption         =   "OK"
  39.       Height          =   375
  40.       Left            =   1200
  41.       TabIndex        =   2
  42.       Top             =   1080
  43.       Width           =   855
  44.    End
  45.    Begin VB.TextBox txtInput 
  46.       Height          =   315
  47.       Left            =   120
  48.       TabIndex        =   0
  49.       Top             =   600
  50.       Width           =   975
  51.    End
  52.    Begin VB.Label lblInput 
  53.       Caption         =   "lblInput"
  54.       Height          =   255
  55.       Left            =   120
  56.       TabIndex        =   1
  57.       Top             =   240
  58.       Width           =   2055
  59.    End
  60. Attribute VB_Name = "frmInput"
  61. Attribute VB_GlobalNameSpace = False
  62. Attribute VB_Creatable = False
  63. Attribute VB_PredeclaredId = True
  64. Attribute VB_Exposed = False
  65. Option Explicit
  66. Private m_bCancel As Boolean
  67. Const TEXT_NR_PLAYERS As String = "Hur m
  68. nga spelare?"
  69. Const TEXT_NAME_PLAYERS As String = "Ange initialer f
  70. r spelare "
  71. Private Sub Form_Load()
  72.     Dim i%
  73.     For i = 1 To 5
  74.         cmbInput.AddItem i
  75.     Next
  76.     cmbInput.ListIndex = 1
  77. End Sub
  78. Public Function ShowInputForm(frmOwner As Form, Optional iPlayer As Integer) As String
  79.     If iPlayer = 0 Then
  80.         txtInput.Visible = False
  81.         cmbInput.Visible = True
  82.         lblInput = TEXT_NR_PLAYERS
  83.         Me.Show vbModal, frmOwner
  84.         ShowInputForm = cmbInput.Text
  85.     Else
  86.         txtInput.Visible = True
  87.         cmbInput.Visible = False
  88.         lblInput = TEXT_NAME_PLAYERS & iPlayer
  89.         txtInput = "P" & iPlayer
  90.         Me.Show vbModal, frmOwner
  91.         ShowInputForm = Left(UCase(LTrim(txtInput)), 2)
  92.     End If
  93.     If m_bCancel Then ShowInputForm = "-1"
  94. End Function
  95. Private Sub cmdCancel_Click()
  96.     Unload Me
  97.     m_bCancel = True
  98.     If frmYatzy.mbGameNotStarted Then End
  99. End Sub
  100. Private Sub cmdOK_Click()
  101.     m_bCancel = False
  102.     Me.Hide
  103. End Sub
  104. Private Sub Form_Paint()
  105.     On Error Resume Next
  106.     cmbInput.SetFocus
  107.     txtInput.SetFocus
  108. End Sub
  109. Private Sub txtInput_GotFocus()
  110.     txtInput.SelStart = 0
  111.     txtInput.SelLength = Len(txtInput.Text)
  112. End Sub
  113.